<!-- UserAvatar.vue 头像组件 -->
<template>
	<img
		:src="src"
		:style="avatarStyle"
		class="avatar"
		alt="user avatar"
	>
</template>

<script setup>
import { computed } from 'vue'

const props = defineProps({
	src: { type: String, required: true },
	size: { type: Number, default: 40 }
})

const avatarStyle = computed(() => ({
	width: `${props.size}px`,
	height: `${props.size}px`,
	borderRadius: '5px'
}))
</script>
